package nl.saxion.dbi.model;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@EqualsAndHashCode
public class KeyVeld implements StringBasedPropertyAble
{

	private Veld veld;

	private Key key;

	private int volgnummer;

	public String toString()
	{
		return new StringBuilder("KeyVeld( veld=").append(veld.toString()).append(", key=").append(key.getId())
			.append(", volgnummer=").append(volgnummer).append(")").toString();
	}

	@Override
	public Object getProperty(String property)
	{
		switch (property)
		{
		case "veld_id":
			return veld.getId();
		case "key_id":
			return key.getId();
		case "volgnummer":
			return volgnummer;
		}
		throw new IllegalStateException("Property " + property + " is niet geldig voor Key");
	}

}
